if (strlen($hip) > 120) { $pos = 160; $crop = $hip; if (strlen($crop) > 160) { $pos = strpos($hip, ".", 120) + 1; } $lip = substr($hip, 0, $pos); }